package com.kgc.sbt.service.impl;

import com.alibaba.dubbo.config.annotation.Reference;
import com.kgc.sbt.api.SearchApi;
import com.kgc.sbt.beans.*;
import com.kgc.sbt.service.SearchService;
import com.kgc.sbt.utils.PageSupportUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * Created on 2021/8/16.
 * <p>
 * Author : Lcywings
 * <p>
 * Description :
 */
@Service
@Slf4j
public class SearchServiceImpl implements SearchService {

    @Reference
    private SearchApi searchApi;

    @Override
    public PageSupportUtil<Product> queryProductList(String keywords, Integer pageSize, Integer pageNo) {
        log.info("调用Api接口查询，参数：{}，{}，{}", keywords, pageSize, pageNo);
        return searchApi.queryProductList(keywords, pageSize, pageNo);
    }

    @Override
    public ProductDetails queryProductDetails(String productId) {
        log.info("调用Api接口查询，参数：{}", productId);
        return searchApi.queryProductDetails(productId);
    }

    @Override
    public List<RotationChart> queryRotationCharts(Integer chartNo) {
        return searchApi.queryRotationCharts(chartNo);
    }

    @Override
    public List<Product> queryCrowdFunding() {
        return searchApi.queryCrowdFunding();
    }

    @Override
    public List<Product> querySecKill() {
        return searchApi.querySecKill();
    }

    @Override
    public List<Product> queryDailyNew() {
        return searchApi.queryDailyNew();
    }

    @Override
    public List<Product> queryVipRecommend(Integer userId) {
        return searchApi.queryVipRecommend(userId);
    }

    @Override
    public List<Boolean> addCollect(Integer userId, Integer productId) {
        return searchApi.addCollect(userId, productId);
    }

    @Override
    public PageSupportUtil<UserCollectDetail> collectList(Integer userId, Integer pageSize, Integer pageNo) {
        return searchApi.collectList(userId, pageSize, pageNo);
    }

    @Override
    public Integer selectUserIdByToken(String token) {
        return searchApi.selectUserIdByToken(token);
    }

    @Override
    public Integer getProductIdByproductCode(String productCode) {
        return searchApi.getProductIdByproductCode(productCode);
    }
}
